<template>
  <div class="app">
    <nav class="top-menu">
      <!-- home kjzj -->
      <router-link to="/kjzj" exact-active-class="active">首页</router-link>
      <router-link to="/kzcs" exact-active-class="active">配置管理</router-link>
      <router-link to="/ztxxfk" exact-active-class="active"
        >信息管理</router-link
      >
      <router-link to="/rwlcjgn" exact-active-class="active"
        >任务流程及功能</router-link
      >
      <router-link to="/dlsf" exact-active-class="active">独立算法</router-link>
      <router-link to="/dlsbkz" exact-active-class="active"
        >独立设备控制</router-link
      >
      <div style="flex: 1 0 0"></div>
      <div style="flex: 0 0 1; margin-right: 10px" @click="loginout">
        您好，管理员
      </div>
    </nav>
    <router-view> </router-view>
  </div>
</template>

<script>
import Top from "../top/top.vue";
import AppBar from "../top/AppBar.vue";

import { ElMessage, ElMessageBox } from "element-plus";

export default {
  name: "TopMenu",
  components: {
    Top,
    AppBar,
  },

  data() {
    return {
      pageTitle: "1111",
      Menu_pos: 0,
    };
  },

  created() {
    // this.addCloseMenu();
    console.log("home");
    this.$router.push("/kjzj");
  },
  methods: {
    loginout() {
      console.log("loginout");

      ElMessageBox.confirm("是否确认退出当前账号?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(function () {
          // ElMessage({
          //   message: "确定",
          //   type: "success",
          // });
          // return delDzwlbind(correctionuserIds);
        })
        .then(() => {
          // this.handleQuery();
          // this.msgSuccess("删除成功");
          this.$router.push("/homelogin");

          // ElMessage({
          //   message: "退出成功！",
          //   type: "success",
          // });
        })
        .catch((e) => {
          console.error(e);
        });
    },
    menu(pos) {
      this.Menu_pos = pos;

      console.log("pos=" + this.Menu_pos);
      if (this.Menu_pos == 0) {
        // this.Component = "/hometest"
        // this.$router.push("/hometest");
      } else if (this.Menu_pos == 1) {
        // this.Component = "/hometest/pzgl"
        this.$router.push("/pzgl");
      } else if (this.Menu_pos == 2) {
        // this.Component = "/hometest/xxgl"
        this.$router.push("/xxgl");
      }
    },
  },
};
</script>

<style scoped lang="scss">
.app {
  margin: 0px;
  padding: 0px;
}

.top-menu {
  display: flex;
  align-items: center;
  background-color: #929396;
  color: white;
  height: 60px;
}

.top-menu a {
  color: white;
  text-decoration: none;
  margin-right: 10px;
  margin-left: 10px;
  display: inline-block;
}

.top-menu a.active {
  font-weight: bold;
}
</style>
